﻿// ***********************************************************************
// Assembly         : STX.Repository
// Author           : seven.x
// Created          : 12-29-2013
//
// Last Modified By : seven.x
// Last Modified On : 01-03-2014
// ***********************************************************************
// <copyright file="IRepository.cs" company="驰创数码">
//     Copyright (c) 驰创数码. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************using System;

using System;
using System.Linq;
using STX.Domain;

namespace STX.Repository
{
    /// <summary>
    /// Interface IDAL
    /// </summary>
    /// <typeparam name="TEntity">The type of the attribute entity.</typeparam>
    public interface IRepository<TEntity>
        where TEntity:BaseEntity
    {
        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns>System.Int64.</returns>
        void Add(TEntity entity);
        /// <summary>
        /// Finds all.
        /// </summary>
        /// <returns>IQueryable{``0}.</returns>
        IQueryable<TEntity> FindAll();
        /// <summary>
        /// Finds all.
        /// </summary>
        /// <param name="exp">The exp.</param>
        /// <returns>IQueryable{``0}.</returns>
        IQueryable<TEntity> FindAll(Func<TEntity, bool> exp);



        IQueryable<TEntity> FindAll(string sql, params object[] parameters);

        /// <summary>
        /// Updates the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        void Update(TEntity entity);
        /// <summary>
        /// Deletes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        void Remove(TEntity entity);

        /// <summary>
        /// Removes the ids.
        /// </summary>
        /// <param name="ids">The ids.</param>
        void RemoveIds(int[] ids);
    }
}
